[−][src]Crate cpp_demangle
This crate can parse a C++ “mangled” linker symbol name into a Rust value
describing what the name refers to: a variable, a function, a virtual table,
etc. The description type implements Display
, producing human-readable
text describing the mangled name. Debuggers and profilers can use this crate
to provide more meaningful output.
C++ requires the compiler to choose names for linker symbols consistently across compilation units, so that two compilation units that have seen the same declarations can pair up definitions in one unit with references in another. Almost all platforms other than Microsoft Windows follow the Itanium C++ ABI's rules for this.
For example, suppose a C++ compilation unit has the definition:
namespace space {
int foo(int x, int y) { return x+y; }
}
The Itanium C++ ABI specifies that the linker symbol for that function must
be named _ZN5space3fooEii
. This crate can parse that name into a Rust
value representing its structure. Formatting the value with the format!
macro or the std::string::ToString::to_string
trait method yields the
string space::foo(int, int)
, which is more meaningful to the C++
developer.
Modules
ast | Abstract syntax tree types for mangled symbols. |
error | Custom |
Structs
DemangleOptions | Options to control the demangling process. |
Symbol | A mangled symbol that has been parsed into an AST. |
Enums
DemangleNodeType | The type of a demangled AST node. This is only partial, not all nodes are represented. |
Traits
DemangleWrite | Sink for demangled text that reports syntactic structure. |
Type Definitions
BorrowedSymbol | A |
OwnedSymbol | A |